class Solution:
    def twoEggDrop(self, n):
        f = [0] + [1e3] * n
        for i in range(1, n + 1):
            for k in range(1, i + 1):
                f[i] = min(f[i], max(k - 1, f[i - k]) + 1)
        return f[n]
